#define _LED_DIS_C_

#include "LedDis.h"
#include "mlib_NixietubeDrive.h"
#include "mlib_NixietubeDrive_Port.h"
#include "Control.h"
#include "flash_dataspace.h"
#include "AdSample.h"

// LED SET
MLIB_NIXIETUBE_OBJECT_S myobject;
uint8_t u8_LedMenuPageIndex = MENU_PAGE_POWERON; // 当前显示菜单页
uint8_t u8_LedMenuItemIndex = 0;                 // 当前菜单中选项序号
uint8_t u8_LedMenuItem = 0;                      // 当前菜单中选项内容
volatile uint16_t u16_LedMenuDisTime = 0;        // 菜单显示时间
uint8_t u8_MenuFlahsFlag = 0;                    // 当前菜单显示效果，闪烁
uint8_t u8_MenuFlahsCycle = 0;                   // 闪烁周期
uint8_t u8_PassWord = 0;                         // 输入密码值
uint8_t u8_NoKeyPressFlashMenuTime = 0;
uint8_t u8_SonwLedFlashFlag = 0xFF;        // 雪花图标闪烁标志
uint8_t u8_SonwLedFlashCycle = 0;          // 雪花闪烁周期
signed char s8_DisplayTempValue = 0;       // 显示的温度值
uint8_t u8_DisplayTempValueRenewTime = 0;  // 温度显示更新时间 1S（1HZ）
uint8_t u8_DisplayF2M2_PwOn = 1;           // F2mode2第一次上电显示实际温度
uint8_t u8_DisplayF2M2ModifyFlag = 0;      // F2mode2修正标志
uint8_t u8_DisplayF2M2ModifyUpOrDown = 0;  // F2mode2修正标志
uint16_t u16_DisplayF2M2ModifyTime = 0;    // F2mode2修正计时
uint8_t u8_DisplayF2M2ModifyTimeState = 0; // F2mode2修正计时

void MenuTimeOutHandle(void)
{
    if (u8_MenuTimeOutExeFlag == 1)
    {
        u8_MenuTimeOutExeFlag = 0;
        // if (u8_TempIsSet)
        // {
        //     u8_GetSetTemp = 1;
        // }
        if (u8_LedMenuPageIndex == MENU_PAGE_POWERON)
        {
            u8_LedMenuPageIndex = MENU_PAGE_MAIN;
            u16_LedMenuDisTime = u8_DisplayTime_F3;
            // u8_GetSetTemp = 1;
        }
        else if (((u8_LedMenuPageIndex == MENU_PAGE_MAIN) && (u8_LedMenuItem == 0)) // 主菜单关屏
                 || (u8_LedMenuPageIndex == MENU_PAGE_ERR))
        {
            u8_LedMenuPageIndex = MENU_PAGE_MAIN;
            if (u8_DisplayTime_F3 > 0) // F3
            {
                u8_LedMenuItem = 1; // 关闭屏幕
                u16_LedMenuDisTime = 0;
            } // 不按键就永久关闭
        }
        else if (u8_LedMenuPageIndex == MENU_PAGE_SET)
        {
            u8_LedMenuPageIndex = MENU_PAGE_MAIN;
            u8_LedMenuItem = 0;
            u16_LedMenuDisTime = u8_DisplayTime_F3;
            s8_SetTemp_C0 = s8_SetTempC0Display; // 退出设定再保存设定温度
            FlashEEPROMSaveSetting();            // 保存数据
        }
        else if (u8_LedMenuPageIndex == MENU_PAGE_PASSWORD)
        {
            if (u8_LedMenuItem == 1)
            {
                if (u8_PassWord == u8_Password_P0) //|| SUPER_PASSWORD == u8_PassWord 密码正确进入工程菜单
                {
                    u8_LedMenuPageIndex = MENU_PAGE_FACTORY;
                    u16_LedMenuDisTime = SET_MENU_TIME;
                    u8_LedMenuItemIndex = Item_P0;
                    u8_LedMenuItem = 0;
                    u8_PassWord = 0;
                }
                else // 密码错误返回P0
                {
                    u8_LedMenuItem = 0;
                    u16_LedMenuDisTime = SET_MENU_TIME;
                }
            }
            else // P0下无操作返回主菜单显示温度
            {
                u8_LedMenuPageIndex = MENU_PAGE_MAIN;
                u8_LedMenuItem = 0;
                u16_LedMenuDisTime = u8_DisplayTime_F3;
            }
        }
        else if (u8_LedMenuPageIndex == MENU_PAGE_FACTORY)
        {
            if (u8_LedMenuItem == 1) // 数据操作没有执行返回上一级
            {
                u16_LedMenuDisTime = SET_MENU_TIME;
                u8_LedMenuItem = 0;
            }
            else
            {
                u8_LedMenuPageIndex = MENU_PAGE_MAIN;
                u16_LedMenuDisTime = u8_DisplayTime_F3;
                u8_LedMenuItemIndex = Item_P0;
                u8_LedMenuItem = 0;
                s8_SetTemp_C0 = s8_SetTempC0Display; // 退出设定再保存设定温度
                FlashEEPROMSaveSetting();            // 保存数据
            }
        }
    }
}

void LedConfig(void)
{
    mlib_Nixietube_init(&myobject);
}

void LedDisplayScan(void)
{
    mlib_Nixietube_Scan(&myobject, sit_set, seg_set);
}

void LedDisPlayControl(void)
{
    MenuTimeOutHandle();
    DisplayValueDeal();

    switch (u8_LedMenuPageIndex)
    {
    case MENU_PAGE_POWERON:
        if (u8_PowerOn == 1)
        {
            u8_PowerOn = 0;
            u16_LedMenuDisTime = POWER_ON_MENU_TIME;
        }
        LedMenuPowerOn();
        break;
    case MENU_PAGE_MAIN:
    {
        if (((u8_HighTempErrFlag == 1)   // 超温报警
             || (u8_LowTempErrFlag == 1) // 超温报警
             || (u8_SensorErrFlag == 1)) // 传感器报警
            && ((u8_LedMenuPageIndex == MENU_PAGE_MAIN) && (u8_LedMenuItem == 0)))
        {
            u8_LedMenuPageIndex = MENU_PAGE_ERR;
            u16_LedMenuDisTime = u8_DisplayTime_F3;
        }
        else
        {
            LedMenuMain();
        }
        break;
    }
    case MENU_PAGE_SET:
        LedMenuSet();
        break;
    case MENU_PAGE_PASSWORD:
        LedMenuPassWord();
        break;
    case MENU_PAGE_FACTORY:
        LedMenuFactory();
        break;
    case MENU_PAGE_ERR:
        LedMenuErr();
        break;
    default:
        break;
    }
    SnowLedFlash(); // 这个需要在刷新过数据后添加，就是要加在更新菜单之后
}

void LedMenuPowerOn(void)
{
    mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_ON);
    mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_ON);
}

void LedMenuMain(void) // 主菜单显示温度
{
    u8_MenuFlahsFlag = 0;
    if (u8_LedMenuItem == 1)
    {
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_OFF);
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_OFF);
    }
    else
    {
        if (u8_DisplayMode_F1 == 0) // 显示方式1
        {
            MenuDisplayMode1();
        }
        else // 显示方式2
        {
            MenuDisplayMode2();
        }
    }
}

void MenuDisplayMode1(void)
{
    mlib_Nixietube_DisplayInt16(&myobject, s8_DisplayTempValue);
}

void MenuDisplayMode2(void)
{
    mlib_Nixietube_DisplayInt16Mode2(&myobject, s8_DisplayTempValue); // s8_DisplayTempValue
}

void DisplayValueDeal(void)
{

    if (u8_DisplayMode_F2 == 0) // 显示模式1 显示实际温度
    {
        if (u8_DisplayTempValueRenewTime)
        {
            u8_DisplayTempValueRenewTime = 0;
            s8_DisplayTempValue = s8_RealTemp;
        }
    }
    else if (u8_DisplayMode_F2 == 1) // 显示模式2
    {

        if (s8_DisplayTempValue != s8_RealTemp)
        {
            if (u8_DisplayF2M2_PwOn) // 上电显示温度为实际温度
            {
                s8_DisplayTempValue = s8_RealTemp;
            }

            if (((s8_SetTemp_C0 - 2) < s8_RealTemp) && (s8_RealTemp < (s8_SetTemp_C0 + 2))) // 实际温度在设定温度的+/-2之间开启修正但不修正，显示实际温度
            {
                u8_DisplayF2M2_PwOn = 0;
                u8_DisplayF2M2ModifyFlag = 1;
                s8_DisplayTempValue = s8_RealTemp;
            }
            else if (s8_RealTemp > (s8_SetTemp_C0 + 2)) // 实际温度在大于设定温度+2，开始修正
            {
                if ((u16_DisplayF2M2ModifyTime == 0) && u8_DisplayF2M2ModifyFlag == 1)
                {
                    u16_DisplayF2M2ModifyTime = 1;
                    // u8_DisplayF2M2ModifyFlag = 1;
                    u8_DisplayF2M2_PwOn = 0;
                    s8_DisplayTempValue = (s8_SetTemp_C0 + 1);
                    // s8_DisplayTempValue += (s8_TempComp_C7 / 10);

                    u8_DisplayF2M2ModifyUpOrDown = 1;
                }

                if ((u8_DisplayF2M2ModifyFlag == 1) && (s8_RealTemp < s8_DisplayTempValue))
                {
                    u8_DisplayF2M2ModifyFlag = 0;
                    u16_DisplayF2M2ModifyTime = 0;
                    u8_DisplayF2M2ModifyUpOrDown = 0;
                }
            }
            else if (s8_RealTemp < (s8_SetTemp_C0 - 2)) // 实际温度在小于设定温度-2，开始修正
            {
                if (u16_DisplayF2M2ModifyTime == 0 && u8_DisplayF2M2ModifyFlag == 1)
                {
                    u16_DisplayF2M2ModifyTime = 1;
                    // u8_DisplayF2M2ModifyFlag = 1;
                    u8_DisplayF2M2_PwOn = 0;
                    s8_DisplayTempValue = (s8_SetTemp_C0 - 1);
                    // s8_DisplayTempValue += (s8_TempComp_C7 / 10);
                    u8_DisplayF2M2ModifyUpOrDown = 2;
                }

                if ((u8_DisplayF2M2ModifyFlag == 1) && (s8_RealTemp > s8_DisplayTempValue))
                {
                    u8_DisplayF2M2ModifyFlag = 0;
                    u16_DisplayF2M2ModifyTime = 0;
                    u8_DisplayF2M2ModifyUpOrDown = 0;
                }
            }
        }

        if (u8_DisplayF2M2ModifyFlag)
        {
            if (u8_DisplayF2M2ModifyUpOrDown == 1)
            {
                if (s8_DisplayTempValue > s8_RealTemp)
                {
                    u8_DisplayF2M2ModifyFlag = 0;
                    u16_DisplayF2M2ModifyTime = 0;
                    u8_DisplayF2M2ModifyUpOrDown = 0;
                    s8_DisplayTempValue = s8_RealTemp;
                }
                else if (u8_DisplayF2M2ModifyTimeState == 3)
                {
                    u8_DisplayF2M2ModifyTimeState = 0;
                    u8_DisplayF2M2ModifyFlag = 0;
                    u16_DisplayF2M2ModifyTime = 0;
                    u8_DisplayF2M2ModifyUpOrDown = 0;
                    s8_DisplayTempValue = s8_RealTemp;
                }
                else if (u8_DisplayF2M2ModifyTimeState == 2)
                {
                    u8_DisplayF2M2ModifyTimeState = 0;
                    s8_DisplayTempValue += 1;
                }
                else if (u8_DisplayF2M2ModifyTimeState == 1)
                {
                    u8_DisplayF2M2ModifyTimeState = 0;
                    s8_DisplayTempValue += 1;
                }
            }
            else if (u8_DisplayF2M2ModifyUpOrDown == 2)
            {
                if (s8_DisplayTempValue < s8_RealTemp)
                {
                    u8_DisplayF2M2ModifyFlag = 0;
                    u16_DisplayF2M2ModifyTime = 0;
                    u8_DisplayF2M2ModifyUpOrDown = 0;
                    s8_DisplayTempValue = s8_RealTemp;
                }
                else if (u8_DisplayF2M2ModifyTimeState == 3)
                {
                    u8_DisplayF2M2ModifyTimeState = 0;
                    u8_DisplayF2M2ModifyFlag = 0;
                    u16_DisplayF2M2ModifyTime = 0;
                    u8_DisplayF2M2ModifyUpOrDown = 0;
                    s8_DisplayTempValue = s8_RealTemp;
                }
                else if (u8_DisplayF2M2ModifyTimeState == 2)
                {
                    u8_DisplayF2M2ModifyTimeState = 0;
                    s8_DisplayTempValue -= 1;
                }
                else if (u8_DisplayF2M2ModifyTimeState == 1)
                {
                    u8_DisplayF2M2ModifyTimeState = 0;
                    s8_DisplayTempValue -= 1;
                }
            }
        }
    }
    else // 显示模式3
    {
        s8_DisplayTempValue = s8_SetTemp_C0;
    }
}

void LedMenuSet(void)
{
    // signed char s8_temp = 0;

    if (u8_MenuFlahsCycle)
    {
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_OFF);
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_OFF);
        return;
    }

    // if (u8_SetTemp_C0 & 0x80)
    // {
    //     s8_temp = -1 * (u8_SetTemp_C0 & 0x7F);
    // }
    if (u8_DisplayMode_F1 == 0) // 显示方式1
    {
        mlib_Nixietube_DisplayInt16(&myobject, s8_SetTempC0Display);
    }
    else
    {
        mlib_Nixietube_DisplayInt16Mode2(&myobject, s8_SetTempC0Display);
    }
}

void LedMenuErr(void)
{
    u8_MenuFlahsFlag = 1;
    if (u8_MenuFlahsCycle)
    {
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_OFF);
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_OFF);
        return;
    }
    if (u8_SensorErrFlag)
    {
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_E);
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_1);
    }
    else if (u8_HighTempErrFlag)
    {
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_H);
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_A);
    }
    else if (u8_LowTempErrFlag)
    {
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_L);
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_A);
    }
}

void LedMenuPassWord(void)
{

    if (u8_MenuFlahsCycle)
    {
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_OFF);
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_OFF);
        return;
    }

    if (u8_LedMenuItem == 0)
    {
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_P);
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_0);
    }
    else
    {
        mlib_Nixietube_DisplayInt16(&myobject, u8_PassWord);
    }
}

void LedMenuFactory(void)
{

    if (u8_MenuFlahsCycle)
    {
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_OFF);
        mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_OFF);
        return;
    }

    switch (u8_LedMenuItemIndex)
    {
    case Item_P0:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_P);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_0);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, u8_Password_P0);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, u8_Password_P0);
            }
        }
    }
    break;
    case Item_C0:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_C);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_0);
        }
        else
        {

            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, s8_SetTempC0Display);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, s8_SetTempC0Display);
            }
        }
    }
    break;
    case Item_C1:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_C);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_1);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, u8_TempUpReturnDiff_C1);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, u8_TempUpReturnDiff_C1);
            }
        }
    }
    break;
    case Item_C2:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_C);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_2);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, u8_TempDownReturnDiff_C2);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, u8_TempDownReturnDiff_C2);
            }
        }
    }
    break;
    case Item_C3:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_C);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_3);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, u8_CompressorOffTime_C3);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, u8_CompressorOffTime_C3);
            }
        }
    }
    break;
    case Item_C4:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_C);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_4);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, u8_Compressor1stOffTime_C4);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, u8_Compressor1stOffTime_C4);
            }
        }
    }
    break;
    case Item_C5:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_C);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_5);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, s8_SetTempUp_C5);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, s8_SetTempUp_C5);
            }
        }
    }
    break;
    case Item_C6:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_C);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_6);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, s8_SetTempDown_C6);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, s8_SetTempDown_C6);
            }
        }
    }
    break;
    case Item_C7:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_C);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_7);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, s8_TempComp_C7);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, s8_TempComp_C7);
            }
        }
    }
    break;
    case Item_C8:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_C);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_8);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, u8_SensorErrCompressorOnTime_C8);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, u8_SensorErrCompressorOnTime_C8);
            }
        }
    }
    break;
    case Item_C9:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_C);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_9);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, u8_SensorErrCompressorOffTime_C9);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, u8_SensorErrCompressorOffTime_C9);
            }
        }
    }
    break;
    case Item_D1:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_D);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_1);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, u8_DefrostCycle_D1);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, u8_DefrostCycle_D1);
            }
        }
    }
    break;
    case Item_D2:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_D);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_2);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, u8_DefrostTime_D2);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, u8_DefrostTime_D2);
            }
        }
    }
    break;
    case Item_A1:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_A);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_1);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, s8_HighTempErr_A1);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, s8_HighTempErr_A1);
            }
        }
    }
    break;
    case Item_A2:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_A);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_2);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, s8_LowTempErr_A2);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, s8_LowTempErr_A2);
            }
        }
    }
    break;
    case Item_A3:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_A);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_3);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, u8_AboveTempContinueTime_A3);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, u8_AboveTempContinueTime_A3);
            }
        }
    }
    break;
    case Item_F1:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_F);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_1);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, u8_DisplayMode_F1);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, u8_DisplayMode_F1);
            }
        }
    }
    break;
    case Item_F2:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_F);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_2);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, u8_DisplayMode_F2);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, u8_DisplayMode_F2);
            }
        }
    }
    break;
    case Item_F3:
    {

        if (u8_LedMenuItem == 0)
        {
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 0, FONT_F);
            mlib_Nixietube_Sit_DisplayNumber(&myobject, 1, FONT_3);
        }
        else
        {
            if (u8_DisplayMode_F1 == 0) // 显示方式1
            {
                mlib_Nixietube_DisplayInt16(&myobject, u8_DisplayTime_F3);
            }
            else
            {
                mlib_Nixietube_DisplayInt16Mode2(&myobject, u8_DisplayTime_F3);
            }
        }
    }
    break;

    default:
        break;
    }
}

void KeyPressMenuNoFlash(void)
{
    if (((u8_LedMenuPageIndex == MENU_PAGE_MAIN) && (u8_LedMenuItem == 0)) //
        || u8_LedMenuPageIndex == MENU_PAGE_SET                            // 长按键检测到按键就恢复菜单显示时间
        || u8_LedMenuPageIndex == MENU_PAGE_PASSWORD                       // 长按键检测到按键就恢复菜单显示时间
        || u8_LedMenuPageIndex == MENU_PAGE_FACTORY                        // 工程菜单
        )                                                                  // 取消传感器故障按键不响应|| ((u8_LedMenuPageIndex == MENU_PAGE_ERR) && (0 == u8_SensorErrFlag))
    {
        u8_NoKeyPressFlashMenuTime = NO_KEY_PRESS_MENU_FLASH_TIME; // 1s
        u8_MenuFlahsFlag = 0;
        u8_MenuFlahsCycle = 0;
        u16_LedMenuDisTime = SET_MENU_TIME;
    }
}

void SnowLedFlash(void)
{
    if (u8_LedMenuPageIndex == MENU_PAGE_POWERON)
    {
        myobject.dis_buff.seg8_general[0] |= 0x80;
        return;
    }
    else if (u8_LedMenuPageIndex == MENU_PAGE_MAIN && u8_LedMenuItem == 1)
    {
        myobject.dis_buff.seg8_general[0] &= 0x7F;
        return;
    }

    if (u8_SonwLedFlashFlag == SONW_LED_FLASH_05HZ    // 0.5HZ
        || u8_SonwLedFlashFlag == SONW_LED_FLASH_1HZ) // 1HZ
    {
        if (u8_SonwLedFlashCycle)
        {
            myobject.dis_buff.seg8_general[0] |= 0x80;
        }
        else
        {
            myobject.dis_buff.seg8_general[0] &= 0x7F;
        }
    }
    else if (u8_SonwLedFlashFlag == SONW_LED_ON)
    {
        myobject.dis_buff.seg8_general[0] |= 0x80;
    }
    else if (u8_SonwLedFlashFlag == SONW_LED_OFF)
    {
        myobject.dis_buff.seg8_general[0] &= 0x7F;
    }
}
